<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./bootstrap.css">
    <script src="./jquery-3.6.0.js"></script>
    <style>
        .good-name {
            white-space: nowrap;

            overflow: hidden;

            text-overflow: ellipsis;
        }
        body{
            background-image: url(./2055455.jpg);
            
        }
    </style>
    <title>Document</title>
</head>

<body>
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>

            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">

                    <li class="dropdown">

                        <ul class="dropdown-menu">
                            <li><a href="#">Action</a></li>
                            <li><a href="#">Another action</a></li>
                            <li><a href="#">Something else here</a></li>
                            <li role="separator" class="divider"></li>
                            <li><a href="#">Separated link</a></li>
                            <li role="separator" class="divider"></li>
                            <li><a href="#">One more separated link</a></li>
                        </ul>
                    </li>
                </ul>
                <form class="navbar-form navbar-left">
                    <div class="form-group">
                        <input type="text" class="form-control xu1_2" placeholder="Search">
                    </div>
                    <button type="button" class="btn btn-default xu1_1">Submit</button>
                </form>
                <ul class="nav navbar-nav navbar-right ">
                    <li><a href="#" id="xu1">登录</a></li>
                    <li><a href="#">购物车</a></li>

                    <li class="dropdown">


                    </li>
                </ul>
            </div><!-- /.navbar-collapse -->
        </div><!-- /.container-fluid -->
    </nav>
    <!-- 导航结尾部分 -->
    <!-- 商品部分 -->
    <div class="container">

    </div>

    <!-- 商品结尾部分 -->
    <script>


        var data = {

            token: localStorage.getItem('token')
        }
        console.log(data)
        $.ajax({
            url: 'https://api.it120.cc/conner/shopping-cart/info',
            type: 'get',
            data

        }).then(res => {
            console.log(res)

            var str = ''
            res.data.items.forEach(i => {
                str += `
              
              <div class="col-sm-6 col-md-4 col-lg-3">
                        <div class="thumbnail">
                        <img class='s-img' style="width: 200px; height: 200px; "
                            src="${i.pic}"alt="">
                        <div class="caption">
                        <h3 class='good-name'>${i.name}</h3>
                        
                        <p good-price1>现价： <span>${i.price}</span>元</p>
                        <p good-store>库存：<span>12134534件</span></p>
                     <p>
                        <a href="#" class="btn btn-primary" role="button">进入详情</a> 
                        <a href="#" class="btn btn-default col-sm-offset-1" role="button" id="xu2" >加入购物车</a>
                     </p>
                </div>
                </div>
            </div>
              
              
              
              `
            });
            document.querySelector('.container').innerHTML = str
        })

    </script>
</body>

</html>